package org.neurone.userspace.dao.impl;

import org.springframework.dao.DataAccessException;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * @author 糖醋鼻子
 *Hibernate实现Dao基类
 */
public abstract class BaseDaoHibernate extends HibernateDaoSupport {

	/**
	 * 根据指定的HQL或SQL返回记录数量
	 * @param resultSql 查询语句
	 * @return 记录数量
	 * @throws DataAccessException
	 */
	protected int getNumberOfQuery(String resultSql) throws DataAccessException {
		return DataAccessUtils.intResult(getHibernateTemplate().find(resultSql));
	}
}
